#ifndef CPPU_H_INCLUDED
#define CPPU_H_INCLUDED

#include "commons.h"

////////////////////////////////////////////////////////////////////////////////////////////////////

class CPPU {
    public:
                        CPPU                            ();
        virtual         ~CPPU                           ();
        void            Update                          ( int );

        void            SetReadPtr                      ( uint8_t (*value)(uint16_t) )          { mRead  = value; }
        void            SetWritePtr                     ( void (*value)(uint16_t, uint8_t) )    { mWrite = value; }

    private:
        uint8_t         GetLCDStatus                    ()const;
        uint8_t         GetLCDMode                      ()const;
        bool            LCDEnabled                      ()const;
        void            UpdateLCDStatus                 ();
        bool            Mode0InterruptEnabled           ()const;
        bool            Mode1InterruptEnabled           ()const;
        bool            Mode2InterruptEnabled           ()const;
        bool            CoincidenceFlagInterruptEnabled ()const;

        int             mTicks;
        uint8_t         ( *mRead )                      ( uint16_t );
        void            ( *mWrite )                     ( uint16_t, uint8_t );
};

////////////////////////////////////////////////////////////////////////////////////////////////////

#endif